package com.gof.example.observer;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/12 19:33.
 * haiming.fei@tongdun.cn
 */
public class Stock extends Observerable {

    private double price;

    public Stock(double price) {
        this.price = price;
    }

    public void changePrice(double increase) {
        this.price = this.price * (1 + increase / 100);
        for (Observer o : super.getObservers()) {
            o.update(this.price);
        }
    }
}
